from Devices.Chiot.BsDevs.ComDev.ComDev import ComDev
from enum import IntEnum

class DimmerDevice(ComDev):
    class DimmerFullStatus:
        def __init__(self):
            self.switchStatus = 0
            self.brightness = 1
            self.memSwitchStatus = 0
            self.backlightStatus = 0
            self.voltageFreq = 60
            self.pwmDuty = 0

            self.timers = []
            self.delay = DimmerDevice.Delay()
        
    class Timer(ComDev.Timer):
        def __init__(self, id = "", enable = False, start = "", end = "", services = [], week = 0):
            super().__init__(id, enable, start, end, services, week)

        def GetServiceString(self):
            serviceString = ""
            for srv in self.services:
                if srv.serviceId == "switch":
                    serviceString += "开关 "
                else: #srv.serviceId == "switch4"
                    serviceString += "未知服务"+srv.serviceId
                serviceString += ("打开;  " if srv.paraValue else "关闭;  ")
            return serviceString[:-3]
